This sample code shows the use of the ExportOptions Object. Modify the following sample code to fit your needs.
Private Sub Command1_Click()
On Error GoTo Command1_Click_Error
Dim crystalApplication As CRPEAuto.Application
Dim crystalReport As CRPEAuto.Report
Dim crystalExportOptions As CRPEAuto.ExportOptions
Set crystalApplication = CreateObject("Crystal.CRPE.Application")
Set crystalReport = crystalApplication.OpenReport _
("d:\crw\reports\craze\wwsales.rpt")
MsgBox "Export using prompt"
'We will be prompted for one of the nearly 40 formats
'as well as the destination, delimiter and numerous other values
'because in this first example we have to define all of
'the ExportOptions at run time
Call crystalReport.Export(True)
'and then we do it by setting the export options
Set crystalExportOptions = crystalReport.ExportOptions
crystalExportOptions.CharFieldDelimiter = ","
crystalExportOptions.CharStringDelimiter = "'"
crystalExportOptions.DiskFileName = "Test.tst"
crystalExportOptions.UseReportDateFormat = True
crystalExportOptions.HTMLFileName = "TestHTML.htm"
crystalExportOptions.FormatType = 3
' 0=no format, 1=crystal report, 2=data interchange,
' 3=html, 4=richtext, ... 14=word for windows, and lots of others
' look for CRExportFormatType in the Object Browser
crystalExportOptions.UseReportNumberFormat = True
crystalExportOptions.DestinationType = 1
' 0=no destination,1=diskfile,2=mapi,3=mailVIM,4=MicrosoftExchange
' found under CRExportDestinationType in the Object Browser
Call crystalReport.Export(False)
Command1_Click_Exit:
Exit Sub
Command1_Click_Error:
If crystalApplication Is Nothing Then
MsgBox "Unable to CreateObject(""Crystal.CRPE.Application"")"
GoTo Command1_Click_Exit
End If
If crystalReport Is Nothing Then
MsgBox "Unable to OpenReport(""d:\crw\reports\craze\wwsales.rpt"")"
GoTo Command1_Click_Exit
End If
MsgBox "Unknown error in Command1_Click routine"
GoTo Command1_Click_Exit
End Sub
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |